import { ListRawState, LoginDataState } from "../types";
import { request } from "../utils/request";

export interface FetchListParamsState {
	wd: string
}

export function fetchList(params: FetchListParamsState) {
	return request({
		url: '/api/list',
		method: 'GET',
		params
	})
}


export function deleteListByID(id: string) {
	return request({
		url: '/api/list',
		method: 'DELETE',
		params: {
			id
		}
	})
}

export function login(data: LoginDataState) {
	return request({
		url: '/api/login',
		method: 'POST',
		data
	})
}

export function editListByID(data: ListRawState) {
	return request({
		url: '/api/list',
		method: 'post',
		data
	})
}


export function addList(data: ListRawState) {
	return request({
		url: '/api/list',
		method: 'put',
		data
	})
}